package com.qf.web.exs;

import com.qf.pojo.R;
import com.qf.pojo.ResultEnum;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public R ex(Exception e) {
        e.printStackTrace();

        return R.error(ResultEnum.ERROR);
    }

    @ExceptionHandler(BusinessException.class)
    public R businessEx(BusinessException ex){

        return R.error(ex.getResultEnum());
    }
}
